package com.paic.mhis.hcpms.common.validator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.paic.pafa.app.biz.bo.validation.ValidStatus;

/**
 * @Description 校验基础类
 * @author wh
 * @date 2014/5/22
 */

public abstract class HcpmsBaseValidator
{
	public ValidatorList validatorList = null;

	public Map<Object, Object> throwErrorMassage(ValidStatus validStatus)
	{
		List<ErrorEntry> errors = validStatus.getErrors();
		Map<Object, Object> attachment = null;
		if(errors.size() > 0)
		{
			attachment = new HashMap<Object, Object> ();
			for(ErrorEntry errorEntry : errors)
			{
				attachment.put(errorEntry.getKey(), errorEntry.getMessage());
			}
			
			return attachment;
		}
		
		return attachment;
	}

	public abstract Map<Object, Object> validate(Map<Object, Object> map);
}
